//
//  STDeitailsTopImageView.m
//  CuiBoStore
//
//  Created by 崔博 on 16/12/8.
//  Copyright © 2016年 崔博. All rights reserved.
//

#import "STDeitailsTopImageView.h"
#import "STProductBannerModel.h"
@interface STDeitailsTopImageView ()<SDCycleScrollViewDelegate>
@property (nonatomic, strong) SDCycleScrollView *bannerView;
@property (nonatomic, strong) UILabel *buyConuntLabel;
@end

@implementation STDeitailsTopImageView

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self == [super initWithFrame:frame]) {

        [self addSubviews];
    }
    return self;
}

- (void)addSubviews
{
    [self addSubview:self.bannerView];
    [self addSubview:self.buyConuntLabel];
    [_buyConuntLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.equalTo(@22);
        make.bottom.equalTo(@(-30));
        make.right.equalTo(@11);
    }];
}
#pragma mark - set
- (void)setImageUrlList:(NSArray *)imageUrlList
{
    NSMutableArray *imgList = [NSMutableArray array];
    for (STProductBannerModel *m in imageUrlList) {
        if ([m.ImgType isEqualToString:@"1"]) {
            [imgList addObject:m.ImgView];
        }
    }
    self.bannerView.imageURLStringsGroup = imgList;
}
- (void)setPeopleCount:(NSString *)peopleCount
{
    self.buyConuntLabel.text = [NSString stringWithFormat:@"%@已经购买      ",peopleCount];
}
#pragma mark - lazy
- (SDCycleScrollView *)bannerView
{
    if (!_bannerView) {
        _bannerView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 380) delegate:self placeholderImage:[UIImage imageNamed:@"详情界面购物车按钮"]];
        _bannerView.pageControlAliment = SDCycleScrollViewPageContolAlimentRight;
    }
    return _bannerView;
}
- (UILabel *)buyConuntLabel
{
    if (!_buyConuntLabel) {
        _buyConuntLabel = [STUIKitTools lableFont:15 textColor:[UIColor whiteColor] text:@"100已经购买      "];
        _buyConuntLabel.backgroundColor = RGB(230, 51, 37);
        _buyConuntLabel.layer.cornerRadius =  11.0;
        _buyConuntLabel.layer.masksToBounds = YES;
        _buyConuntLabel.textAlignment = NSTextAlignmentCenter;
    }
    return _buyConuntLabel;
}
@end
